package net.peelmeagrape.hibernate.collections;

import net.peelmeagrape.hibernate.xmlgen.XmlAttribute;
import net.peelmeagrape.hibernate.xmlgen.XmlElement;
import net.peelmeagrape.hibernate.xmlgen.AddPropertyNameAsAttribute;
import net.peelmeagrape.hibernate.xmlgen.ChildElement;
import net.peelmeagrape.hibernate.MetaValue;
import net.peelmeagrape.hibernate.Column;

import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.ElementType.METHOD;
import java.lang.annotation.Retention;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
import java.lang.annotation.Target;

/**
 * Collection values of many-to-any type.
 */
@Target({METHOD,FIELD}) @Retention(RUNTIME)
@XmlElement(name="many-to-any")
@AddPropertyNameAsAttribute(name="name")
public @interface ManyToAny
{
    @XmlAttribute("id-type") String idType();
    @XmlAttribute("meta-type") String metaType() default "Hibernate.CLASS";

    @ChildElement(1) MetaValue[] metaValue() default {};
    @ChildElement(2) Column classnameColumn();
    @ChildElement(3) Column[] columnMapping() default {};

}
